<div class="p-h-md p-v bg-white box-shadow pos-rlt">
  <h3 class="no-margin">广告计划管理</h3>
</div>
<div class="p-md">
  <div class="panel panel-default">
    <div class="panel-heading">广告计划列表</div>
    <table class="table table-bordered table-hover bg-white">
      <thead>
      <tr>
        <th>广告计划名</th>
        <th>起始时间</th>
        <th>结束时间</th>
        <th>花费</th>
        <th>曝光量</th>
        <th>点击量</th>
        <th>点击率</th>
        <th>点击均价</th>
        <th>平均千次展示费用</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      </tbody><colgroup><col>
      <col width="11%">
      <col width="11%">
      <col width="7%">
      <col width="9%">
      <col width="9%">
      <col width="7%">
      <col width="12%">
      <col width="14%">
      <col width="6%">
    </colgroup>
      <tbody>
      <% @campaigns&.each do |campaign| %>
          <tr>
            <td><a href="/campaigns/sitetype?sitesetType=${campaign.sitesetType }"><%= campaign.name %></a></td>
            <td><%= DateTime.parse(campaign.min_created_at.to_s).strftime('%Y-%m-%d %H:%M:%S').to_s  %></td>
            <td><%= DateTime.parse(campaign.max_created_at.to_s).strftime('%Y-%m-%d %H:%M:%S').to_s  %></td>
            <td><%= number_to_currency(campaign.cost,  :unit=>"￥") %></td>
            <td><%= campaign.view_num %></td>
            <td><%= campaign.click_num %></td>
            <td><%= campaign.view_num.nil? ||campaign.view_num.to_i==0? 0 : format("%0.2f", campaign.click_num.to_i*100/campaign.view_num.to_i) %></td>
            <td><%= number_to_currency( campaign.click_num.nil? ||campaign.click_num.to_i==0? 0 : campaign.view_num/campaign.click_num,  :unit=>"￥") %></td>
            <td><%= number_to_currency( campaign.view_num.nil? ||campaign.view_num.to_i==0? 0 : campaign.cost*1000/campaign.view_num,  :unit=>"￥") %></td>
            <td>
              <label class="ui-switch bg-info">
                <input type="checkbox" checked="checked" disabled>
                <i></i>
              </label>
            </td>
          </tr>
      <% end %>
      </tbody>
    </table>
  </div>
</div>

